package com.cxx.purchasecharge.core.model.persistence;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.cxx.purchasecharge.core.model.BaseModel;
import com.cxx.purchasecharge.core.model.ContractStatusCode;

/**
 * 合同
 */
@Entity
@Table (name = "pc_contract")
public class Contract extends BaseModel
{
    private static final long serialVersionUID = 1L;

    private long id;
    private String name;
    private long customerId;
    private float dealMoney;
    private String deliverAddr;
    private Date start;
    private Date end;
    private String signerOnCustom;
    private String signerOnService;
    private long signUserId;
    private long userCreatedBy;
    private long userUpdatedBy;
    private Date signDate;

    private ContractStatusCode statusCode = ContractStatusCode.NEW;
    private String body;
    private String comment;
    private Project project;

    public Contract ()
    {
    }

    public Contract (String name)
    {
        this.name = name;
    }

    @Id
    @GeneratedValue (strategy = GenerationType.AUTO)
    public long getId ()
    {
        return id;
    }

    public void setId (long id)
    {
        this.id = id;
    }

    @Column (nullable = false, unique = true)
    public String getName ()
    {
        return name;
    }

    public void setName (String name)
    {
        this.name = name;
    }

    @Column (nullable = false)
    public long getCustomerId ()
    {
        return customerId;
    }

    public void setCustomerId (long customerId)
    {
        this.customerId = customerId;
    }

    public float getDealMoney ()
    {
        return dealMoney;
    }

    public void setDealMoney (float dealMoney)
    {
        this.dealMoney = dealMoney;
    }

    public String getDeliverAddr ()
    {
        return deliverAddr;
    }

    public void setDeliverAddr (String deliverAddr)
    {
        this.deliverAddr = deliverAddr;
    }

    @Column (nullable = false)
    public Date getStart ()
    {
        return start;
    }

    public void setStart (Date start)
    {
        this.start = start;
    }

    @Column (nullable = false)
    public Date getEnd ()
    {
        return end;
    }

    public void setEnd (Date end)
    {
        this.end = end;
    }

    public String getSignerOnCustom ()
    {
        return signerOnCustom;
    }

    public void setSignerOnCustom (String signerOnCustom)
    {
        this.signerOnCustom = signerOnCustom;
    }

    public String getSignerOnService ()
    {
        return signerOnService;
    }

    public void setSignerOnService (String signerOnService)
    {
        this.signerOnService = signerOnService;
    }

    @Column (nullable = false)
    public long getSignUserId ()
    {
        return signUserId;
    }

    public void setSignUserId (long signUserId)
    {
        this.signUserId = signUserId;
    }

    @Column (nullable = false)
    public long getUserCreatedBy()
    {
        return userCreatedBy;
    }

    public void setUserCreatedBy(long userCreatedBy)
    {
        this.userCreatedBy = userCreatedBy;
    }

    @Column (nullable = false)
    public long getUserUpdatedBy()
    {
        return userUpdatedBy;
    }

    public void setUserUpdatedBy(long userUpdatedBy)
    {
        this.userUpdatedBy = userUpdatedBy;
    }

    @Column (nullable = false)
    public Date getSignDate ()
    {
        return signDate;
    }

    public void setSignDate (Date signDate)
    {
        this.signDate = signDate;
    }

    @Column (nullable = false)
    public ContractStatusCode getStatusCode ()
    {
        return statusCode;
    }

    public void setStatusCode (ContractStatusCode statusCode)
    {
        this.statusCode = statusCode;
    }

    @Column (length = 2048)
    public String getBody ()
    {
        return body;
    }

    public void setBody (String body)
    {
        this.body = body;
    }

    @Column (length = 1024)
    public String getComment ()
    {
        return comment;
    }

    public void setComment (String comment)
    {
        this.comment = comment;
    }

    @OneToOne
    public Project getProject ()
    {
        return project;
    }

    public void setProject (Project project)
    {
        this.project = project;
    }
}
